package com.fary.boot.autoconfigure.security.servlet;

import com.fary.boot.autoconfigure.condition.ConditionalOnClass;
import com.fary.boot.autoconfigure.condition.ConditionalOnMissingBean;
import com.fary.boot.autoconfigure.condition.ConditionalOnWebApplication;
import com.fary.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
import com.fary.boot.autoconfigure.security.SecurityProperties;
import com.fary.context.annotation.Configuration;
import com.fary.core.annotation.Order;
import com.fary.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

@Configuration(proxyBeanMethods = false)
// 当引入了spring-security-core包
@ConditionalOnClass(WebSecurityConfigurerAdapter.class)
// 没有自定义创建 WebSecurityConfigurerAdapter 实例bean
@ConditionalOnMissingBean(WebSecurityConfigurerAdapter.class)
// Servlet环境
@ConditionalOnWebApplication(type = Type.SERVLET)
public class SpringBootWebSecurityConfiguration {

	// 配置一个空的 WebSecurityConfigurerAdapter 静态子类实际没做什么操作
	@Configuration(proxyBeanMethods = false)
	@Order(SecurityProperties.BASIC_AUTH_ORDER)
	static class DefaultConfigurerAdapter extends WebSecurityConfigurerAdapter {

	}

}